<?php
namespace app\beautiful\controller\admin\member;
use app\beautiful\model\member\MemberCouponModel;
use app\BaseController;
use app\common\logic\DataLogic;

class Coupon extends BaseController{
    public function index()
    {
        $member_id =$this->request->param('member_id/d',0);
        $where=[
            ['shop_id','=',$this->request->shopId]
        ];
        if(!empty($member_id)) $where[]=['member_id','=',$member_id];

        $member_coupon=new MemberCouponModel();
        $order=['add_time'=>'desc'];
        $field="member_coupon_id,name,valid_bg_time,valid_end_time,coupon_money,money_limit,add_time,status";
        $append=['add_time_format'];
        $return = DataLogic::getDataList($member_coupon,$where,$order,$field,$this->request->limit,$this->request->page,$append);
        return $this->success($return);
    }
}
